package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConExplainUpload;
import com.htgd.gardenexpo.dao.GeConExplainUploadDao;
import com.htgd.gardenexpo.service.GeConExplainUploadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConExplainUpload)表服务实现类
 *
 * @author makejava
 * @since 2021-06-17 13:57:47
 */
@Service("geConExplainUploadService")
public class GeConExplainUploadServiceImpl implements GeConExplainUploadService {
    @Resource
    private GeConExplainUploadDao geConExplainUploadDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConExplainUpload queryById(Integer id) {
        return this.geConExplainUploadDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConExplainUpload> queryAllByLimit(int offset, int limit) {
        return this.geConExplainUploadDao.queryAllByLimit(offset, limit);
    }
    @Override
    public List<GeConExplainUpload> queryByExplainId(int id) {
        return this.geConExplainUploadDao.queryByExplainId(id);
    }

    /**
     * 新增数据
     *
     * @param geConExplainUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConExplainUpload insert(GeConExplainUpload geConExplainUpload) {
        this.geConExplainUploadDao.insert(geConExplainUpload);
        return geConExplainUpload;
    }

    /**
     * 修改数据
     *
     * @param geConExplainUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConExplainUpload update(GeConExplainUpload geConExplainUpload) {
        this.geConExplainUploadDao.update(geConExplainUpload);
        return this.queryById(geConExplainUpload.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConExplainUploadDao.deleteById(id) > 0;
    }

    @Override
    public boolean deleteByExplainId(Integer id) {
        return this.geConExplainUploadDao.deleteByExplainId(id) > 0;
    }

    @Override
    public boolean deleteByIds(String[] id,int eid) {
        return this.geConExplainUploadDao.deleteByIds(id,eid) > 0;
    }
}
